is_game_window_active

This function checks whether your game window is currently in focus.

bool is_game_window_active()

Parameters:
None.

Return value:
true if your game window is currently active, false otherwise.

Remarks:
This function returns true if your game window has keyboard focus at the present time. It is imperative that you call show_game_window before you rely on this function.

Example:
// Play a looping sound only while the game window has focus.

void main()
{
show_game_window("Temperamental Sound");
sound noise;
noise.load("myfile.ogg");
if(noise.active==false)
{
alert("Error", "The sound could not be loaded.");
exit();
}
while(true)
{
if((key_down(KEY_LMENU))&&(key_pressed(KEY_F4)))
{
exit();
}
if(is_game_window_active()==true)
{
if(noise.playing==false)
{
noise.play_looped();
}
}
else
{
if(noise.playing==true)
{
noise.pause();
}
}
wait(5);
}
}